cmake_minimum_required(VERSION 3.2)

PROJECT(pb)

LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
INCLUDE(cmake/ModuleImport.cmake)
INCLUDE(cmake/ModuleCompileOptions.cmake)
INCLUDE(cmake/LuaModule.cmake)
ModuleSetCompileOptions()
ModuleSetWinCompilerFlags()

SET(PB_VERSION_MAJOR "1")
SET(PB_VERSION_MINOR "0")
SET(PB_VERSION_PATCH "1")
SET(PB_VERSION "${PB_VERSION_MAJOR}.${PB_VERSION_MINOR}.${PB_VERSION_PATCH}")

MESSAGE(STATUS "VERSION: ${PB_VERSION}")

ADD_DEFINITIONS(-DUSE_PB)
ADD_DEFINITIONS(-DLUA_COMPAT_MODULE -DLUA_COMPAT_APIINTCASTS)
OPTION(USE_PB_INNER "use lua inner" ON)
OPTION(USE_PB_TEST "use pb test" ON)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

SET(LUA_MODULE lua54)
SET(LUADUMPMODULE_VERSION_MAJOR "1")
SET(LUADUMPMODULE_VERSION_MINOR "0")
SET(LUADUMPMODULE_VERSION_PATCH "1")
SET(LUADUMPMODULE_VERSION "${LUADUMPMODULE_VERSION_MAJOR}.${LUADUMPMODULE_VERSION_MINOR}.${LUADUMPMODULE_VERSION_PATCH}")

MESSAGE(STATUS "VERSION: ${LUADUMPMODULE_VERSION}")

ADD_DEFINITIONS(-DUSE_LUADUMPMODULE)
ADD_DEFINITIONS(-DLUA_COMPAT_MODULE -DLUA_COMPAT_APIINTCASTS)

LuaModuleImport("${LUA_MODULE}" "pb" "src/pb" "")
